#ifndef HPLC_QINFINE_PROTOCOLCOMMON_H
#define HPLC_QINFINE_PROTOCOLCOMMON_H

#include "base/baseprotocol.h"
#include "hplcqinfinesendcommonsystempacket.h"
#include "hplcqinfinecheckpacket.h"

#include "common/hplcqinfineparsecommonpacket.h"
#include "common/hplcqinfineparsecommonsystempacket.h"
#include "modulehplcdefine.h"

namespace hplc
{
namespace qinfine
{

class HplcQinfineProtocolCommonData;
class HplcQinfineProtocolCommon : public ::BaseProtocol
{
	Q_OBJECT
public:
    HplcQinfineProtocolCommon(CommonParam &param, QObject *parent = nullptr);
    virtual ~HplcQinfineProtocolCommon() override;

    virtual bool setConfig(int id, const QVariant &var) override;
    virtual bool getConfig(int id, QVariant &var) override;

    virtual bool setProtocolCmd(int id, QVariant &var) override;
    virtual bool getProtocolCmd(int id, QVariant &var) override;

    HplcQinfineCheckPacket *getChecker();
    HplcQinfineParseCommonPacket *getCommonParser();
    HplcQinfineParseCommonSystemPacket *getCommonSystemParser();
    HplcQinfineSendCommonPacket *getCommonSender();
    HplcQinfineSendCommonSystemPacket *getCommonSystemSender();

public slots:
    virtual void setModel(quint8 model);

    virtual void onBaseTickTimeout() override;

protected:
    explicit HplcQinfineProtocolCommon(HplcQinfineProtocolCommonData &data, CommonParam &param, QObject *parent = nullptr);
};

} // qinfine
} // hplc

#endif // HPLC_QINFINE_PROTOCOLCOMMON_H
